package meconsea.life.admin.web;

import java.util.Map;

import meconsea.life.admin.accessor.AdminUserAccessor;
import meconsea.life.admin.entity.AdminUser;
import meconsea.life.util.Constant;

import org.apache.log4j.Logger;

import com.google.inject.Inject;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class IndexAct extends ActionSupport {
	private static final Logger log = Logger.getLogger(IndexAct.class);
	private String pvValue;
	public String getPvValue() {
		return pvValue;
	}

	public void setPvValue(String pvValue) {
		this.pvValue = pvValue;
	}

	@Inject
	private AdminUserAccessor adminUserAccessor;
	
	public String execute(){
		Map sessionMap = ActionContext.getContext().getSession();
		AdminUser au = (AdminUser)sessionMap.get(Constant.ADMIN_USER_SESSION);
		if(au == null){
			return Constant.ADMIN_LOGIN;
		}
		AdminUser au_ = this.adminUserAccessor.find(au.getId());
		setPvValue(au_.getAdminPv().getPvValue());
		return SUCCESS;
	}
}
